package com.alavente.adapters;

import java.util.Date;

import org.apache.commons.beanutils.BeanUtils;

import com.alavente.forms.DemandeVenteForm;
import com.alavente.objects.Categorie;
import com.alavente.objects.Client;
import com.alavente.objects.DemandeVente;
import com.alavente.objects.SsCategorie;

public class DemandeVenteAdapter extends AbstractAdapter<DemandeVenteForm, DemandeVente> {
	
	public DemandeVente adapt(DemandeVenteForm form) {
		
		DemandeVente businessObj = new DemandeVente();		
		super.adapt(form, businessObj);
		
		businessObj.setCategorie(new Categorie(form.getNumCategorie()));
		businessObj.setSsCategorie(new SsCategorie(form.getNumSsCategorie()));
		businessObj.setClient(new Client(form.getNumUser()));
		
		Date date = new Date();
		businessObj.setDateDepot(date);
		businessObj.setDateFin(date);
		
		return businessObj;
	}
}
